package logic_control;

import java.util.Scanner;

public class Number_1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个整数: ");
        int num = scanner.nextInt();
        int num1 = num;
        int n = 0;
        while (num1 != 0) {
            num1 = num1 & (num1 - 1);
            n++;
        }
        System.out.println(num + "二进制1的个数为: " + n);
    }
}
